package com.itheima.train.manager.order.handler.controller;

import com.itheima.train.manager.domain.Order;
import com.itheima.train.manager.order.handler.service.TbOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/orderHandler")
public class OrderHandlerController {

    @Autowired
    private TbOrderService orderService ;

    @RequestMapping(value = "/queryById/{orderId}")
    public Order queryById(@PathVariable(value = "orderId") Long orderId) {
        return orderService.queryOrderById(orderId) ;
    }

    @RequestMapping(value = "/queryOrderInfo/{userId}/{trainNum}/{trainRidingDate}")
    public Order queryOrderInfo(@PathVariable(value = "userId") String userId ,@PathVariable(value = "trainNum") String trainNum , @PathVariable(value = "trainRidingDate")String trainRidingDate) {
        return orderService.queryOrderInfo(userId , trainNum , trainRidingDate) ;
    }

}
